#ifndef __WIRE_BLOCK_H__
#define __WIRE_BLOCK_H__

#include "Block.hpp"
#include "IPaintableBlock.hpp"

namespace PocketSurvival
{
    // 导线 未完成...
    class WireBlock : public Block, public IPaintableBlock
    {
    public:
        static constexpr int32_t Index()
        {
            return 133;
        }
        WireBlock();
        virtual int32_t getIndex() override; 
        virtual const std::string &getBlockName() override;

        virtual void getCreativeValues(std::vector<int32_t> &blockVec) override;
        virtual void getDropValues(int32_t oldValue, int32_t newValue, int32_t toolLevel, std::vector<BlockDropValue> &dropValues) override;
    
        virtual BlockPlacementData getPlacementValue(ComponentMiner *componentMiner, int32_t value, const TerrainRaycastResult &raycastResult) override;
        virtual const std::vector<BoundingBox> &getCustomCollisionBoxes(int32_t value) override;

        virtual int32_t getPaintColor(int32_t value) override;
        virtual int32_t paint(int32_t value, int32_t color) override;
        
        static inline int32_t GetColor(int32_t data);
        static inline int32_t SetColor(int32_t data, int32_t color);
		
    };

    inline int32_t WireBlock::GetColor(int32_t data)
    {
        if ((data & 0x40) != 0)
        {
        	return (data >> 7) & 0xF;
        }
        return -1;
    }
    inline int32_t WireBlock::SetColor(int32_t data, int32_t color)
    {
        if (color != -1)
        {
        	return (data & -1985) | 0x40 | ((color & 0xF) << 7);
        }
        return data & -1985;
    }
} // namespace PocketSurvival


#endif
